<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./img.png">
    <style>
/*使用雪碧图的优点：
    1.图片占用空间小
    2.图片加载速度快，用户体验好
    3.可以解决图片闪烁问题
*/
        .box1{
            width: 149px;
            height: 146px;
            background-image: url('./img.png');
        }
        /* 设置鼠标移动时的效果 */
        .box1:hover{
            background-image: url('./img.png');
            background-position-x: -745px;
        }
        /* 设置鼠标点击时的效果 */
        .box1:active{
            background-image: url('./img.png');
            background-position: -596px -146px;
        }
        .box2{
            width: 149px;
            height: 146px;
            background-image: url('./img.png');
            background-position-y: -146px;
        }
        .box2:hover{
            background-image: url('./img.png');
            background-position: -745px -292px;
        }
    </style>
</head>
<body>
    <div class="box1"></div>
    <div class="box2"></div>
</body>
</html>